package com.szq.ai.healthcare;

import com.szq.ai.healthcare.assistant.AiAgent;
import com.szq.ai.healthcare.bean.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

/**
 * @author: szq
 * @description:
 * @date: 2025-05-28 09:07:53
 * @return
 */
@Tag(name = "Ai小智")
@RestController
@RequestMapping("/ai")
public class AiChatController {

    @Autowired
    private AiAgent aiAgent;

    @Operation(summary = "对话")
    @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestBody ChatForm chatForm) {
        return aiAgent.chat(chatForm.getMemoryId(), chatForm.getMessage());
    }

}
